/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.aurelius.testngexecutionlogger;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 *
 * @author Lukasz
 */
public class Repository {

    private List<Integer> data = new CopyOnWriteArrayList<Integer>();
    private final int size;
    private final ConcurrentHashMap concurrentHashMap;

    public Repository(int storageSize) {
        concurrentHashMap = new ConcurrentHashMap();
        this.size = storageSize;
    }


    /**
     * Get the value of data
     *
     * @return the value of data
     */
    public List<Integer> getData() {
        return data;
    }

    /**
     * Set the value of data
     *
     * @param data new value of data
     */
    public void setData(List<Integer> data) {
        this.data = data;
    }

    public void fillRepository() {
        for (int i = 0; i < size; i++) {
            data.add(i);
        }
    }

    public void addObject(int index, int value) {
        synchronized (data) {
            data.add(index, value);
        }
    }
}
